package com.fqgj.xjd.user.dao.impl;
import com.fqgj.common.base.AbstractBaseMapper;
import com.fqgj.xjd.user.dao.UserFrozenCodeMapDao;
import com.fqgj.xjd.user.entity.UserFrozenCodeMapEntity;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* User: zhangxingyun
* Date: 2017-07-29
* Time: 13:57:46.436
*/

@Repository
public class UserFrozenCodeMapDaoImpl extends AbstractBaseMapper<UserFrozenCodeMapEntity> implements UserFrozenCodeMapDao {

    @Override
    public List<UserFrozenCodeMapEntity> selectUserFrozenCodeMapByUserCode(String userCode) {
        Map<String, Object> map = new HashMap<>();
        map.put("userCode", userCode);
        map.put("endDate", new Date());
       return getSqlSession().selectList(getStatement("selectUserFrozenCodeMapByUserCode"), map);
    }

    @Override
    public UserFrozenCodeMapEntity selectUserFrozenCodeMapByUserCodeAndFrozenCode(String userCode, String frozenCode,String categoryCode) {
        Map params = new HashMap();
        params.put("userCode",userCode);
        params.put("frozenCode",frozenCode);
        params.put("categoryCode",categoryCode);
        return getSqlSession().selectOne(getStatement("selectUserFrozenCodeMapByUserCodeAndFrozenCode"),params);
    }
    @Override
    public List<UserFrozenCodeMapEntity> selectUserFrozenCodeMapByUserCodeAndCategoryCode(String userCode, String categoryCode) {
        Map params = new HashMap();
        params.put("userCode",userCode);
        params.put("categoryCode",categoryCode);
        return getSqlSession().selectList(getStatement("selectUserFrozenCodeMapByUserCodeAndCategoryCode"),params);
    }
    @Override
    public List<UserFrozenCodeMapEntity> selectUserFrozenCodeMapByCondition(String frozenEndDate, String frozenCode, Integer pageSize) {
        Map<String, Object> map = new HashMap<>();
        map.put("frozenEndDate",frozenEndDate);
        map.put("frozenCode",frozenCode);
        map.put("pageSize",pageSize);
        return getSqlSession().selectList(getStatement("selectUserFrozenCodeMapByCondition"), map);
    }

}